class CreateSearchKeywordStatistics < ActiveRecord::Migration
  def self.up
    create_table :search_keyword_statistics do |t|
      t.string    :keyword, :limit => 100, :null => false
      t.integer   :total,   :default => 1
      t.integer   :status,  :default => 0
      t.integer   :flag,    :limit => 4
      t.timestamps
    end

    create_table :search_keyword_lines do |t|
      t.string    :keyword, :limit => 100, :null => false
      t.string    :ip,      :limit => 20
      t.integer   :flag,    :limit => 4,   :default => 0
      t.timestamps
    end

    create_table :top_statistics do |t|
      t.integer   :topable_id,  :null => false
      t.string    :topable_type,:null => false, :limit => 100
      t.integer   :sort_order,  :default => 0
      t.integer   :flag
      t.timestamps
    end
  end

  def self.down
    drop_table  :search_keyword_statistics
    drop_table  :search_keyword_lines
    drop_table  :top_statistics
  end
end
